home *** CD-ROM | disk | FTP | other *** search
- //
- // CPUGestalt.c
- //
- // This sample code illustrates the way to determine the
- // processor type of the Macintosh you're running on
- //
- // For the latest Gestalt CPU type, refer to the
- // latest Gestalt.h
- //
-
- #include <Gestalt.h>
- #include <stdio.h>
-
- main()
- {
- OSErr err;
- long getCPUtype;
-
- // check to see if we're on a Power Macintosh
- err = Gestalt (gestaltNativeCPUtype, &getCPUtype);
-
- if (0x100 & getCPUtype) {
- // we are on a Power Macintosh
- if (getCPUtype == gestaltCPU601)
- printf( "\nThis is a Power Macintosh with a 601 processor." );
- else if (getCPUtype == gestaltCPU603)
- printf( "\nThis is a Power Macintosh with a 603 processor." );
- else if (getCPUtype == gestaltCPU604)
- printf( "\nThis is a Power Macintosh with a 604 processor." );
- else
- printf( "\nThis is a Power Macintosh with a processor that I am unaware of." );
- } else {
- // we are on a 68K Macintosh
- err = Gestalt ( gestaltProcessorType, &getCPUtype );
- if (getCPUtype == gestalt68040)
- printf( "\nThis is a 68K Macintosh with a 68040 processor." );
- else if (getCPUtype == gestalt68030)
- printf( "\nThis is a 68K Macintosh with a 68030 processor." );
- else if (getCPUtype == gestalt68020)
- printf( "\nThis is a 68K Macintosh with a 68020 processor." );
- else if (getCPUtype == gestalt68010)
- printf( "\nThis is a 68K Macintosh with a 68010 processor." );
- else if (getCPUtype == gestalt68000)
- printf( "\nThis is a 68K Macintosh with a 68000 processor." );
- else
- printf( "\nThis is a 68K Macintosh with a processor that I am unaware of." );
- }
- }
-